program programa;
 
var 
    i, j: integer; 
    max, maxi, maxj: longint;
function reverse(sk: longint):boolean;
	var tempsk, rev: longint;
begin

        rev:=0;
        tempsk:=sk;
        while (tempsk<>0) do
        begin
	        rev:=rev+tempsk mod 10;
	        tempsk:=tempsk div 10;
	        if tempsk<>0 then 
		        rev:=rev*10;

        end;
        reverse:=(sk=rev);

end;

begin

    max:=0;
    for i:=999 downto 100 do
    begin
        for j:=999 downto 100 do
        begin
           if (reverse(i*j)=true) then 
                if (max<i*j) then
                    begin                    
                        max:=i*j;
                        maxi:=i; 
                    end;
        end;
    end;	
    writeln('max trizenklis sk: ', max);
end. 
